home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 26
/
Cream of the Crop 26.iso
/
bbs
/
mydoor01.zip
/
MYDOOR.DOC
< prev
next >
Wrap
Text File
|
1997-07-22
|
22KB
|
551 lines
▀▀▀ ▀▀▀ ▀▀ ▀▀ ▀▀▀▀▀▀ ▀▀▀▀▀ ▀▀▀▀▀ ▀▀▀▀▀▀
▀▀▀▀ ▀▀▀▀ ▀▀ ▀▀ ▀▀ ▀▀ ▀▀ ▀▀ ▀▀ ▀▀ ▀▀ ▀▀
▀▀ ▀▀▀ ▀▀ ▀▀▀▀ ▀▀ ▀▀▀ ▀▀▀ ▀▀▀ ▀▀▀ ▀▀▀ ▀▀▀▀▀▀
▀▀ ▀ ▀▀ ▀▀ ▀▀ ▀▀ ▀▀ ▀▀ ▀▀ ▀▀ ▀▀ ▀▀
▀▀ ▀▀ ▀▀ ▀▀▀▀▀▀ ▀▀▀▀▀ ▀▀▀▀▀ ▀▀ ▀▀
(Also Known As "Generation III Library" Used For Carlton Doors)
═══════════════════════════════════════════════════════════════════════════════
A Utility For Creating BBS Doorgames And Online Utilities Using Qbasic 4.x
═══════════════════════════════════════════════════════════════════════════════
A Personal Note:
I started writing doors in 1988 with a serial routine/library called Catpatch.
From 1990 to 1995 I experimented with several door writing utilites; some
worked (and were supported) better than others.
After picking up snippets of code from different public libraries, I compiled
a set of instructions that seems to operate quite nicely. The variable names
and subroutine names are very similar to another library you may have tried.
This is not 'stolen code'. After I switched from the last library I had
registered from somebody else, I had the unpleasent task of re-writing twenty
doorgames of my own. To minimize the amount of re-coding, I named variables
and routines very similarly to the other library.
If you're making the same switch I did, you'll see how little coding you need
to do to make the transition.
The one main "feature" I have to offer, is that this is a LIVE project. I use
MYDOOR almost daily for my own door writing. It's not just a project name that
I have added to my list of money-makers. It's my main tool. I use it, and I
support it.
There are cases when routines are important to a door's operation, but used so
infrequently I hesitate to add them to the pre-compiled library (such as the
hot-key input). In such cases, I provide the routine for you to add to the
main body of the code. These little tricks are great for keeping the size of
the final door down when compiled.
The chat function has been removed from this library. It is now used solely in
my CHAT WINDOW door, and has been removed so that I don't have to worry about
competing with myself. <g>
═══════════════════════════════════════════════════════════════════════════════
PAGE - 1 -
LEGAL/TECHNICAL:
THIS DOCUMENT ASSUMES THAT YOU HAVE MICROSOFT(C) QUICKBASIC(C) V4.x INSTALLED
INTO C:\QBASIC. IF YOU HAVE IT INSTALLED ANYWHERE ELSE, YOU MUST BE SMART
ENOUGH TO SUBSTITUTE YOUR DIRECTORY NAME WHEN USING MY EXAMPLES.
MYDOOR WILL NOT WORK PROPERLY WITH MICROSOFT(C) QBASIC(C) WHICH WAS INCLUDED
WITH SEVERAL VERSIONS OF MICROSOFT(C) DOS(C). ALL PRODUCTS REFERRED TO IN THIS
DOCUMENT ARE COPYRIGHTED BY THEIR RESPECTFUL OWNER, REGARDLESS OF WHETHER THEY
ARE MARKED WITH (C) OR NOT.
═══════════════════════════════════════════════════════════════════════════════
PREPARING QBASIC TO CALL THE LIBRARY:
Edit your autoexec.bat and add the past to qbasic. This saves you from having
to program in your C:\QBASIC directory. Reboot your machine once after the
change is made. (BTW: In this document, I try not to assume anything, so bare
with me if I seem a bit dull at times...)
Copy all of the MYDOOR.* files into your C:\QBASIC directory.
Make a directory under your C:\QBASIC directory to program in. We'll call
ours: C:\QBASIC\SAMPLE in this document.
Go to your C:\QBASIC directory, and type: QB
Use ALT/O (Options Menu), select Paths, and point the Library and Include
Files path to your C:\QBASIC directory. OK your selections and exit QBASIC.
═══════════════════════════════════════════════════════════════════════════════
CALLING THE LIBRARY:
To start QBASIC with the library loaded, type: QB /LMYDOOR
The /L tell QBASIC that MYDOOR is an external library.
The very first line of every program you ever write with mydoor will be:
'$INCLUDE: 'C:\QBASIC\MYDOOR.BI'
The next three lines should be:
version = "(Put Door Name And Version Number Here)"
author$ = "(Your Name)"
mydoor$ = "unregistered"
example:
version = "DoorMania II v1.00"
author$ = "Todd Carlton"
mydoor$ = "unregistered"
Page - 2 -
CALLING THE LIBRARY (cont.)
version: Appears centered at the bottom of the screen locally while the door
is running.
author$: Your name. The mydoor registration code is linked to this name.
mydoor$: Put your mydoor registration number in here once you've registered
the library to get rid the mydoor unregistered screen. Entering
anything other than "unregistered" or a valid registration code
will cause the door to not run.
═══════════════════════════════════════════════════════════════════════════════
LOADING THE BBS DROPFILE:
It's important for you to know how MAKENODE.EXE works. It creates a table of
values used by all MYDOOR and CARLTON BBS Doors.
The path to MYDOOR.INF (the node information table) must be stored in the
variable: nodepath$ which is deciphered by the routine read.cnf.
I get all my information up front by reading a door configuration file.
One of my typical configuration files is read like this:
OPEN "BBSDOOR.CFG" FOR INPUT SHARED AS #1
LINE INPUT #1, SysName
LINE INPUT #1, BoardNam
LINE INPUT #1, Nodepath$
LINE INPUT #1, AscScore$
LINE INPUT #1, AnsScore$
LINE INPUT #1, Reg$
CLOSE #1
Notice that the file is opened for SHARED access. This is important when
writing doors to be run on multi-node BBSes.
Line 1: 'sysname' is the MYDOOR variable that stores the name of the Sysop
who is running the door.
Line 2: 'boardnam' is the MYDOOR variable that stores the name of the BBS
that the door is being run on.
Line 3: 'nodepath$' is the MYDOOR variable that stores the path to the node
information table.
Line 4: 'ascscore$' is a variable I chose to write an ascii score file to.
Line 5: 'ansscore$' is a variable I chose to write an ansi/color score file to.
Line 6: 'reg$' is a variable I chose to hold the door's registration code.
MYDOOR does not automatically create a registration code for your
doors. For the registration to CARLTON doors I use parts of the sysname
and boardnam variables, and perform mathematics on their ascii codes.
SPECIAL NOTE: usernam is the variable that holds the caller's name.
═══════════════════════════════════════════════════════════════════════════════
Page - 3-
THE SAMPLE DOOR SO FAR:
'$INCLUDE: 'C:\QBASIC\MYDOOR.BI'
version = "Test Door v1.00"
author$ = "Todd Carlton"
mydoor$ = "unregistered"
OPEN "BBSDOOR.CFG" FOR INPUT SHARED AS #1
LINE INPUT #1, SysNam
LINE INPUT #1, BoardNam
LINE INPUT #1, Nodepath$
LINE INPUT #1, AscScore$
LINE INPUT #1, AnsScore$
LINE INPUT #1, Reg$
CLOSE #1
read.cnf Nodepath$
═══════════════════════════════════════════════════════════════════════════════
MYDOOR COMMANDS:
COMMAND (VARIABLES)
DESCRIPTION
EXAMPLE
─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─
at (ypos%, xpos%)
Places the cursor at a screen position; ypos% down from top, xpos% from the
left edge of the screen. ypos% represents rows, xpos% represents columns.
(SPECIAL NOTE: Don't get hung-up on the variable names. In mathematical terms
the X-Coordinate is the vertical element.)
EXAMPLE: at 10, 40
─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─
at.say (row%, col%, mes$)
Prints the information stored in mes$ at the specified row (vertical) and
column (horizontal). at.say DOES NOT send a carriage return or line feed
after it's display, so the cursor is left the the end of your display instead
of moving down the first position of the next line.
EXAMPLE: at.say 10, 70, "Score: " + score$
Page - 4 -
MYDOOR COMMANDS (cont):
box.it (x%, y%, fgc%, bgc%, high, wide)
Prints a two-color box x% rows from the top, y% columns from the left, with
a color of fgc%, "shading" color of bgc%. The high and wide variables DO NOT
include the corners. (A box 1 high by one wide will actually occupy 3x3
positions with corners.)
EXAMPLE: box.it 5, 10, 11, 9, 3, 8
─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─
chime
Makes the standard PC "Ding" one time, both locally and on the remote end.
EXAMPLE: chime
─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─
clear.scr
Clears the screen. SPECIAL NOTE: clear.scr DOES NOT change colors before
clearing the screen, so if the last color you set was white on a blue back-
ground, clear.scr will clear to a new screen with a blue background. Also
some people use black-on-black with in.put (below) to fool callers into think-
ing they're in a hot-keyed menu. I typically set the correct color immediately
before clearing the screen. It's a good habit.
EXAMPLE: clear.scr
─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─
colr (fg%, bg%, blink%)
Sets the current color using standard ANSI color codes. fg% is the foreground
color, bg% is the background color and blink% is either a 1 (on) or 0 (off).
SPECIAL NOTE: If you activate blink%, all new output will blink until you turn
it off again.
EXAMPLE: colr 15, 0, 0
Page - 5-
MYDOOR COMMANDS (cont.):
fiex(filename$)
Checks to see if a file exists. If the file exists, fiex(filename$) = -1. If
the file does not exist fiex(filename$) = 0.
EXAMPLE: IF fiex("scores.dat") = 0 THEN GOSUB CREATESCORE: ELSE GOTO READSCORE
─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─
in.put (wide%, hot%, ifg%, ibg%, blink%, msg$, tfg%, tbg%, row%, col%, hide%)
Gets input from caller. Input is limited to the number of characters specified
in wide%. hot% is either 0 or 1. if hot% is 1 the routine will process (without
pressing ENTER) as soon as they have entered the number of characters soecified
in wide%. If wide%=1 and hot% = 1 then after the caller presses 1 key, the
routine will continue. If wide% = 1 and hot% = 0 the caller must press 1 key,
plus the ENTER key. ifg% sets the input foreground color, ibg% sets the input
background color. blink% determines whether the output from msg$ blinks (0 or
1 again). msg$ is the question you're asking for input, or it may be a null ""
if you want nothing displayed before the input. tfg% is the forground color for
msg$, tbg% is the background color for msg$. row% and col% are the screen
positions you want the msg$ to begin displaying at. hide% determines whether
you want the caller to see what they're typing OR IF IT SHOULD BE REPLACED WITH
BLOCKS. If you don't want the caller to see anything about what they're typing,
you need to set ifg% and bgc% to the current background color.
The caller's input as they entered it is stored in response$. The caller's
input in all upper case letters is stored in arg$.
SPECIAL NOTE: Not even *I* remember all the parameters on this beast! If you
have the library properly loaded, you can type "in.put" on a line, put your
cursor on the "i" and press [F1] and the parameters will pop up in a window.
EXAMPLE: in.put 2, 0, 15, 1, 0, "Your Bet (1-10):", 14, 0, 22, 35, 0
─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─
leave (n%)
This MUST be the last command executed in your door. leave puts the fossil
back to original condition, closes up MYDOOR data channels and leaves the
system nice and clean for the BBS to resume operation. Newer BBSes expect
doors to have poor communication maintenance, so neglecting to use leave will
not hurt them. Forgetting to use leave may lock up older BBSes. the variable
n% is either 1 (display closing message) or 0 (exit without closing message).
EXAMPLE: leave 0
Page - 6 -
MYDOOR COMMANDS (cont.):
nl (n%)
nl (null line) simply sends the number of carriage returns stored in n%.
EXAMPLE: nl 3
─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─
pause (row%)
Puts the prompt "Press Any Key To Continue..." at whatever row is specified
for row%.
EXAMPLE: pause 23
─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─
read.cnf (nodepath$)
Reads in the node communication parameters from MYDOOR.INF, which is created
by MAKENODE.EXE. It's use is further documented above in "THE SAMPLE DOOR
SO FAR:" section.
EXAMPLE: read.cnf nodepath$
─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─
rip.check
This routine was written to check a callers terminal for compatibility with
RipScrip(C) 1.5x from Telegrafix(C). If the caller's terminal supports the
RipScrip(C) 1.5x standard, then rip%=1. If not, rip% = 0. (SPECIAL NOTE:
I personally gave up on Rip after 1.54 and do not offer any Rip routines in
this library, other than to check for 1.5x's existance. I have no idea how
v2.x works, and have no interest in further supporting Telegrafix(C)'s
product.)
EXAMPLE: rip.check
─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─
set.status
Toggles status bars at the bottom of the screen while the door is running.
EXAMPLE: set.status 1
PAGE - 7 -
MYDOOR COMMANDS (cont.):
show.mess (mes$, carriage%)
Displays output stored in mes$ at the current cursor location. If carriage%=1
a carriage return is sent. If carriage%=0, the cursor is left at the end of
the output displayed.
EXAMPLE: show.mess "New Score: ",0: GOSUB scorecalc: show.mess STR$(score),1
─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─
trim (st$)
I found myself doing a LTRIM$(RTRIM$()) frequently to make sure I got rid
of leading and trailing spaces, so trim was invented. Trim removes leading
and trailing spaces.
EXAMPLE: A$ = trim(A$)
─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─
waitasec (sec%)
Pauses the program for the number of seconds specified in sec%.
EXAMPLE: waitasec 4
═══════════════════════════════════════════════════════════════════════════════
MYDOOR HOT KEYED INPUT:
Action Doorgames always fascinated me. My problem to solve was to give a
caller only so long to press keys, then have the door do something, whether
they responded or not, then go back to the caller for another chance to
interact.
If you have no idea what I'm talking about, think of TETRIS(C). You can rotate
the blocks, you can force them to fall faster, or you can move them from side
to side. But even if you do nothing, they continue to fall down the screen.
If you look through all the MYDOOR files in this archive, you'll see that the
routines (above) are an end-set for your use. There are close to a hundred
sub-sets of routines to make the doors work. User time must be tracked,
carrier has to be tested for. Fossils initialized and deinitialized, etc.
So it's with these sub-level routines I developed a hot-key scenario!
Page - 8 -
MYDOOR HOT KEYED INPUT (cont.):
The only way I can really explain this is with commented example, so read
closely!
SAMPLE CODE:
PLAYERMOVE:
check = TIMER: REM COMMENT LINE 1
drop = .75: REM COMMENT LINE 2
DO
time.dozeoff = time.remaining: REM COMMENT LINE 3
arg$ = INKEY$: REM COMMENT LINE 4
IF DataWaiting THEN arg$ = UCASE$(CHR$(ReadChar)): REM COMMENT LINE 5
IF arg$ = "1" THEN
REM BLAH BLAH BLAH
END IF
IF arg$ = "A" THEN
REM BLAH BLAH BLAH BLAH
END IF
IF arg$ = "?" THEN
REM BLAH BLAH BLAH BLAH BLAH
END IF
IF arg$ = "Q" THEN quit = 1
LOOP UNTIL (TIMER > check + drop) or (TIMER < 1): REM COMMENT LINE 6
IF quit = 1 THEN GOTO OVER
REM DOOR MAKES IT'S MOVES, THEN RETURNS TO PLAYERMOVE:
Line 1: The only part of every PC I could find that runs "the same" from an
XT to a Pentium 166 was the timer. By using the timer, the door will run at
the same speed, regardless of what kind of PC the BBS runs on!
Line 2: (This sample is from my TRIS door.) I used a variable called drop to
adjust how long a player has inside this routine. In the real game, I deduct
.10 from the drop variable every 5 completed lines, giving the player less time
to respond before the door went on without them.
Line 3: Because we're down in the "low-level" code, I don't get the benefits
of checking carrier, etc. Typically time.dozeoff kicks the caller out of the
door for inactivity. Since we KNOW they're active (for at least 3/4 of a
second) we make sure the door doesn't timeout on the caller.
Line 4: We get input from the local keyboard, so people can play locally;
or mess with the caller's game as the case may be... ;)
Line 5: If there's a carrier, we read the incoming characters next, giving
it "last say" or "higher priority" to override a local keypress, thus
stopping interference from mischevious local watchers.
Page - 9 -
MYDOOR HOT KEYED INPUT (cont.):
The argument block activates subroutines for the door to perform whatever
function is actiavted by the keypress. Note: These MUST BE SUBROUTINES so
the command structure resturns to our timed block. When the door finally
ends, it must be from the doormoves area, not the playermove.
Line 6: Once the player/caller has had their time to respond, the door gets
to make it's moves. The reason we check for TIMER < 1 is because if a player
plays past midnight (where TIMER = 000000), the game would go into an endless
loop. When programming, you must consider ALL possibilities.
═══════════════════════════════════════════════════════════════════════════════
DISPLAYING FILES:
I removed two routines from MYDOOR. One showed ANSI files, the other multi-
page ASCII. Here is the code, in case you ever need it:
Displaying One-Screen Files:
Colr 15, 0, 0: Clear.Scr
OPEN "DISPLAY.ANS" FOR INPUT SHARED AS #35
DO: LINE INPUT #35, line$: SHOW.MESS line$, 1
LOOP UNTIL EOF(35): CLOSE #35: PAUSE 23
Displaying Multi-Screen Files:
Colr 15, 0, 0: Clear.Scr
OPEN "BOOK.ASC" FOR INPUT SHARED AS #35
lin = 0
DO: LINE INPUT #35, line$: SHOW.MESS line$, 1: lin = lin + 1
IF lin = 22 THEN PAUSE 23: Colr 15, 0, 0: Clear.scr: lin = 0
LOOP UNTIL EOF(35): CLOSE #35: PAUSE 23
═══════════════════════════════════════════════════════════════════════════════
RUNNING MYDOOR DOORS:
MYDOOR Doors all use the same installation procedure.
Run the MAKENODE.EXE utility to create the file MYDOOR.INF
Once MAKENODE.EXE is run one time to create node definitions, it won't ever
need to run it again unless a node is changed or added. The MYDOOR.INF is
good for EVERY door written with the MYDOOR library.
Page - 10 -
MAKENODE.EXE: Explained
The COMMON DIRECTORY is a directory that ALL nodes have access to. Typically
this would be the main directory where the BBS Program resides.
Answer questions A-F for each of the nodes. For the more technical questions
(like the base addresses for your port) infomational windows appear at the
bottom of the screen, providing "standard" choices. If the SYSOP has specially
configured ports or non-standard IRQ's, change the values to the correct infor-
mation. If a SYSOP can successfully run a non-standard port, MYDOORS will
operate on them.
If the SYSOP runs a "local only" node, set it up as if it's a standard node on
COM1:. The SYSOP must answer every question for each node.
The command line to run a door is DOORNAME # (# is the number of the node
accessing the file). If your door is named: BESTDOOR.EXE then the command to
run it on node 2 is: BESTDOOR 2
To run a door in local mode (without starting the BBS) you can either just
use the doorname, or you can use a zero for the node number.
═══════════════════════════════════════════════════════════════════════════════
CALLING FOR HELP:
I support the MYDOOR library, I don't support your doors or your code.
If you have any questions about the MYDOOR library, it's operation, any
bugs (which I haven't found any in over two years...) or suggestions for
more routines I can be reached:
U.S. Postal: E-Mail: todd@pca.net
Todd Carlton FidoNet: 1:130/319
2009A Oakwood Ct Echo: FidoNet DOORGAMES
Arlington, TX 76012 BBS: 1-817-794-0126
═══════════════════════════════════════════════════════════════════════════════
LAST WORDS:
I am working on a "demo door" to show off all the features of the MYDOOR
library. Until it's done, I'm easiest contacted by E-Mail which I check
several times a day. Instead of constantly updating the library (which is
right now 100% stable) I am planning on putting up a web-site with requested
routines you can cut-and-paste into your doors as you need them.
If you come up with an awsome routine that is worth modifying the library,
I certainly will, but one feature of the library is it's compact size.
In the next release, some lesser-used routines (like box.it) may be moved
from the library to a cut-and-paste routine.
Page - 11 -